import Vue from 'vue'
import App from './App.vue'
import router from './router'
import './plugins/element.js'
import './assets/css/global.css'
import './assets/css/index_ctrl.css'
import './assets/fonts/iconfont.css'
import axios from 'axios'
axios.defaults.baseURL = 'http://127.0.0.1:8888/api/private/v1/'
//把axios挂载到vue 的 $http上,通过this.$http就能访问到
Vue.prototype.$http = axios

Vue.config.productionTip = false
//【axios拦截器】登陆后，给每个接口加一个token的请求头【保证拥有获取数据的权限】
axios.interceptors.request.use(config=>{
  //console.log(config);
  config.headers.Authorization = window.sessionStorage.getItem('token');
  return config;
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
